<form id="form" #f="ngForm" name="form" class="form" (ngSubmit)="save()" novalidate>
  <div layout="row">
    <md-input-container flex>
      <input mdInput
       id="title"
       name="title"
       #title="ngModel"
       [(ngModel)]="post.title"
       required/>

      <md-error align="start" *ngIf="title.hasError('required')">
        Post Title is required
      </md-error>
    </md-input-container>
  </div>


  <div layout="row">
    <md-input-container flex>
      <textarea mdInput
        #content="ngModel"
        name="content"
        id="content"
        [(ngModel)]="post.content"
        rows="8"
        required
        minlength="10">
      </textarea>

      <md-error align="start" *ngIf="content.hasError('required')">
        Post Content is required
      </md-error>
      <md-error align="start" *ngIf="content.hasError('minlength')">
        At least 10 chars
      </md-error>
    </md-input-container>
  </div>

  <div layout="row">
    <button md-raised-button color="primary" type="submit" class="btn btn-success btn-lg" [disabled]="f.invalid || f.pending">  {{'save'}}</button>
  </div>
</form>
